replication package for:
=======================

cowley, p. and umit, r. legislator dissent does not affect electoral outcomes.
british journal of political science.


computation:
===========

the results in this study were last replicated on 2022-10-28, with the following
computational specifications.

- device:
--------

  - processor	       intel(r) core(tm) i5-10210u cpu @ 1.60ghz 2.11 ghz
  - installed ram.   32.0 gb
  - system type	     64-bit operating system, x64-based processor

- operating system:
------------------

  - edition	  windows 11 pro
  - version	  22h2
  - os build	22621.675

- software:
----------

  - r (4.2.1), with the following additional packages installed:
    - broom (1.0.1)
    - fixest (0.11.0)
    - marginaleffects (0.7.1)
    - psych (2.2.9)
    - rio (0.5.29)
    - rmarkdown (2.17)
    - stargazer (5.2.3)
    - tidyverse (1.3.2)
  - note that: 
    - if any of the above packages are not already installed, the script 
    "02_main_script.R" will prompt their installation

- r session:
-----------

Matrix products: default

locale:
[1] LC_COLLATE=English_Switzerland.utf8  LC_CTYPE=English_Switzerland.utf8   
[3] LC_MONETARY=English_Switzerland.utf8 LC_NUMERIC=C                        
[5] LC_TIME=English_Switzerland.utf8    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] forcats_0.5.2         stringr_1.4.1         dplyr_1.0.10         
 [4] purrr_0.3.5           readr_2.1.3           tidyr_1.2.1          
 [7] tibble_3.1.8          ggplot2_3.3.6         tidyverse_1.3.2      
[10] stargazer_5.2.3       rmarkdown_2.17        rio_0.5.29           
[13] psych_2.2.9           marginaleffects_0.7.1 fixest_0.11.0        
[16] broom_1.0.1          

loaded via a namespace (and not attached):
 [1] httr_1.4.4          jsonlite_1.8.3      modelr_0.1.9       
 [4] Formula_1.2-4       assertthat_0.2.1    googlesheets4_1.0.1
 [7] cellranger_1.1.0    yaml_2.3.6          numDeriv_2016.8-1.1
[10] pillar_1.8.1        backports_1.4.1     lattice_0.20-45    
[13] glue_1.6.2          digest_0.6.30       checkmate_2.1.0    
[16] rvest_1.0.3         colorspace_2.0-3    sandwich_3.0-2     
[19] htmltools_0.5.3     pkgconfig_2.0.3     haven_2.5.1        
[22] scales_1.2.1        openxlsx_4.2.5.1    tzdb_0.3.0         
[25] googledrive_2.0.0   farver_2.1.1        generics_0.1.3     
[28] ellipsis_0.3.2      withr_2.5.0         cli_3.4.1          
[31] mnormt_2.1.1        crayon_1.5.2        magrittr_2.0.3     
[34] readxl_1.4.1        evaluate_0.17       fs_1.5.2           
[37] fansi_1.0.3         nlme_3.1-160        xml2_1.3.3         
[40] foreign_0.8-83      dreamerr_1.2.3      tools_4.2.1        
[43] data.table_1.14.4   hms_1.1.2           gargle_1.2.1       
[46] lifecycle_1.0.3     munsell_0.5.0       reprex_2.0.2       
[49] zip_2.2.1           compiler_4.2.1      tinytex_0.42       
[52] rlang_1.0.6         grid_4.2.1          rstudioapi_0.14    
[55] labeling_0.4.2      gtable_0.3.1        DBI_1.1.3          
[58] curl_4.3.3          R6_2.5.1            zoo_1.8-11         
[61] lubridate_1.8.0     knitr_1.40          fastmap_1.1.0      
[64] utf8_1.2.2          insight_0.18.6      stringi_1.7.8      
[67] parallel_4.2.1      Rcpp_1.0.9          vctrs_0.5.0        
[70] dbplyr_2.2.1        tidyselect_1.2.0    xfun_0.34    


- processing time:
-----------------

  - 5 hours. 
  - note that:
    - this excludes the time required to acquire the besip data and to 
    install any missing software and packages
    - 4.8 hours of this processing time is spent on creating figure 1

instructions:
============

1. set the working directory in r to the location of this file, "01_README.txt"

2. open "02_main_script.R" and run line 5 to unzip "03_replication_files.zip"

3. download the combined wave 1-23 (v23.0) of the british election study
internet panel (besip) data from 
www.britishelectionstudy.com/data-objects/panel-study-data/, and save it to
the following directory:
"03_replication_files/02_data/01_raw/02_bes_ip/". note that:

  - "BES2019_W23_Panel_v23.0.dta" is the data file used for analysis in this
  study. if a different version (other than v23.0) of the data is to be
  downloaded, edit line 3 in the following file accordingly:
  "03_replication_files/01_preparation/03_clean_bes_ip.R"

4. run the remaining lines in "02_main_script.R" consecutively. note that:

  - tables and figures are first displayed (in console or viewer) and
  then saved in "04_output/" as pdf files


datasets:
========

1. "03_replication_files/02_data/01_raw/01_public_whip/"

  - this directory holds raw data on mps' votes in each division, downloaded on
  2021-06-11 from https://www.publicwhip.org.uk/project/data.php

  - the original data file for the 2010-2015 term, "votematrix-2010.dat",
  is missing 13 divisions that took place after 2015-03-12. these are included 
  manually, in "votematrix-2010-completed.dat". this study uses the latter file

  - "03_replication_files/01_preperation/02_clean_public_whip.R" cleans the data
  in this directory, and saves the clean data into the following file:
  "03_replication_files/02_data/06_divisions.rds"
  
2. "03_replication_files/02_data/01_raw/02_bes_ip/"

  - the directory is provided as empty, provided as a placeholder for the besip 
  data
  
  - the besip data cannot be included in this replication package due to
  copyright restrictions, but it can be downloaded freely upon registration,
  from www.britishelectionstudy.com/data-objects/panel-study-data/
  
  - choose the combined wave 1-23 (v23.0), named "BES2019_W23_Panel_v23.0.dta".
  otherwise edit the file name in line 3 in the following file accordingly:
  "03_replication_files/01_preparation/03_clean_bes_ip.R"
  
     - "03_replication_files/01_preperation/03_clean_bes_ip" cleans this data,
  and saves the clean data into the following file:
  "03_replication_files/02_data/06_voters.rds"
  
  - note that new releases of the besip combined wave can include updates 
  to existing observations. therefore, if a different version of the combined 
  wave file were to be used for replication, the results might differ from those 
  reported in this study
  
3. "03_replication_files/02_data/02_intermediate/sizes.rds"

  - this dataset provides data on daily statistics for party and parliamentary
  sizes
  
  - it is collected on 2021-06-11 from https://www.theyworkforyou.com/mps/
  
  - it is not used for analysis directly. instead, it is used to create
  variables that depend on size statistics in
  "03_replication_files/02_data/06_divisions.rds"
  
4. "03_replication_files/02_data/03_secondary/cowley_stuart.rds"
  - this dataset includes two different measures of dissent
  
  - it originates from cowley and stuart (2009, 2013)

5. "03_replication_files/02_data/04_mps.rds"

  - this is the mp-level dataset collected by the authors
  

references:
==========

cowley, p., and stuart, m. (2009). dissension amongst the parliamentary labour
party, 2008–2009: a data handbook. university of nottingham.

cowley, p., and stuart, m. (2013). cambo chained: dissension amongst the
coalition’s parliamentary parties, 2012–2013: a data handbook. university of
nottingham.